#tag Module
Protected Module testBoard
	#tag Method, Flags = &h1
		Protected Sub Run()
		  #if DebugBuild then
		    TestTile
		    TestRotateClockwise
		    TestRotateCounterClockwise
		    TestGetPossibleSides
		    TestGameBoard
		    TestSlots
		  #endif
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestTile()
		  #if DebugBuild then
		    dim testTile as new Tile
		    dim northSide as new Town(testTile)
		    dim eastSide as new Street(testTile)
		    dim southSide as new Grassland(testTile)
		    dim westSide as new Street(testTile)
		    dim dbgMsg as string
		    dim sCon as Connections
		    dim tCon as Connections
		    dim test as Connections
		    
		    unitTests.classes = unitTests.classes + 1
		    
		    testTile.SetNorthSection (northSide)
		    testTile.SetEastSection(eastSide)
		    testTile.SetSouthSection(southSide)
		    testTile.SetWestSection(westSide)
		    
		    testTile.grid.SetSlot("n", 3)
		    testTile.grid.SetSlot("ne", 1)
		    testTile.grid.SetSlot("c", 2)
		    testTile.grid.SetSlot("s", 1)
		    
		    
		    sCon.north = false
		    sCon.east = true
		    sCon.south = false
		    sCon.west = true
		    
		    testTile.SetStreetConnections sCon
		    
		    tcon.north = false
		    tcon.east = false
		    tcon.south = false
		    tcon.west = false
		    
		    testTile.SetTownConnections tCon
		    
		    //test if the terrain-types are correct
		    
		    dbgMsg = "testTile.northSection.GetTerrainType"
		    
		    if testTile.GetNorthSection.GetTerrainType = "Town" then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.eastSection.GetTerrainType"
		    
		    if testTile.GetEastSection.GetTerrainType = "Street" then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.southSection.GetTerrainType"
		    
		    if testTile.GetSouthSection.GetTerrainType = "Grassland" then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.westSection.GetTerrainType"
		    
		    if testTile.GetWestSection.GetTerrainType = "Street" then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    //test the slots
		    // should be like this (X means slot is active, . means slot is inactive)
		    // . X X
		    // . X .
		    // . X .
		    
		    
		    dbgMsg = "testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    dbgMsg = "testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Townconnections" 
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Streetconnections"
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		  #endif
		  
		  
		  
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestRotateClockwise()
		  #if DebugBuild then
		    dim testTile as new Tile
		    dim northSide as new Town(testTile)
		    dim eastSide as new Street(testTile)
		    dim southSide as new Grassland(testTile)
		    dim westSide as new Street(testTile)
		    dim dbgMsg as string
		    dim sCon as Connections
		    dim tCon as Connections
		    dim test as Connections
		    
		    unitTests.classes = unitTests.classes + 1
		    
		    testTile.SetNorthSection (northSide)
		    testTile.SetEastSection(eastSide)
		    testTile.SetSouthSection(southSide)
		    testTile.SetWestSection(westSide)
		    
		    testTile.grid.SetSlot("n", 3)
		    testTile.grid.SetSlot("ne", 1)
		    testTile.grid.SetSlot("c", 2)
		    testTile.grid.SetSlot("s", 1)
		    
		    
		    sCon.north = false
		    sCon.east = true
		    sCon.south = false
		    sCon.west = true
		    
		    testTile.SetStreetConnections sCon
		    
		    tcon.north = true
		    tcon.east = false
		    tcon.south = false
		    tcon.west = false
		    
		    testTile.SetTownConnections tCon
		    
		    
		    testTile.RotateClockwise
		    
		    //West should be now on Top
		    //this means the tile-slots should look like that now
		    // . . .
		    // X X X
		    // . . X
		    //
		    // X means active
		    // . means inactive
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top)Townconnections"
		    
		    tcon.north = false
		    tcon.east = true
		    tcon.south = false
		    tcon.west = false
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:West is on top) Streetconnections"
		    
		    scon.north = true
		    scon.east = false
		    scon.south = true
		    scon.west = false
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    
		    
		    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		    testTile.rotateClockwise
		    
		    //South should be now on Top
		    //this means the tile-slots should look like that now
		    // . X .
		    // . X .
		    // X X .
		    //
		    // X means active
		    // . means inactive
		    dbgMsg = "(Clockwise:South is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top)Townconnections"
		    
		    tcon.north = false
		    tcon.east = false
		    tcon.south = true
		    tcon.west = false
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:South is on top) Streetconnections"
		    
		    scon.north = false
		    scon.east = true
		    scon.south = false
		    scon.west = true
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		    testTile.rotateClockwise
		    
		    //East should be now on Top
		    //this means the tile-slots should look like that now
		    // X . .
		    // X X X
		    // . . .
		    //
		    // X means active
		    // . means inactive
		    dbgMsg = "(Clockwise:East is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) Townconnections"
		    
		    tcon.north = false
		    tcon.east = false
		    tcon.south = false
		    tcon.west = true
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(Clockwise:East is on top) Streetconnections"
		    
		    scon.north = true
		    scon.east = false
		    scon.south = true
		    scon.west = false
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		  #endif
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestRotateCounterClockwise()
		  #if DebugBuild then
		    dim testTile as new Tile
		    dim northSide as new Town(testTile)
		    dim eastSide as new Street(testTile)
		    dim southSide as new Grassland(testTile)
		    dim westSide as new Street(testTile)
		    dim dbgMsg as string
		    dim sCon as Connections
		    dim tCon as Connections
		    dim test as Connections
		    
		    unitTests.classes = unitTests.classes + 1
		    
		    testTile.SetNorthSection (northSide)
		    testTile.SetEastSection(eastSide)
		    testTile.SetSouthSection(southSide)
		    testTile.SetWestSection(westSide)
		    
		    testTile.grid.SetSlot("n", 3)
		    testTile.grid.SetSlot("ne", 1)
		    testTile.grid.SetSlot("c", 2)
		    testTile.grid.SetSlot("s", 1)
		    
		    
		    sCon.north = false
		    sCon.east = true
		    sCon.south = false
		    sCon.west = true
		    
		    testTile.SetStreetConnections sCon
		    
		    tcon.north = true
		    tcon.east = false
		    tcon.south = false
		    tcon.west = false
		    
		    testTile.SetTownConnections tCon
		    
		    testTile.rotateCounterClockwise
		    
		    //East should be now on Top
		    //this means the tile-slots should look like that now
		    // X . .
		    // X X X
		    // . . .
		    //
		    // X means active
		    // . means inactive
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) Townconnections"
		    
		    tcon.north = false
		    tcon.east = false
		    tcon.south = false
		    tcon.west = true
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: East is on top) Streetconnections"
		    
		    scon.north = true
		    scon.east = false
		    scon.south = true
		    scon.west = false
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		    testTile.rotateCounterClockwise
		    
		    //South should be now on Top
		    //this means the tile-slots should look like that now
		    // . X .
		    // . X .
		    // X X .
		    //
		    // X means active
		    // . means inactive
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top)Townconnections"
		    
		    tcon.north = false
		    tcon.east = false
		    tcon.south = true
		    tcon.west = false
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: South is on top)Streetconnections"
		    
		    scon.north = false
		    scon.east = true
		    scon.south = false
		    scon.west = true
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    
		    
		    
		    //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
		    testTile.rotateCounterClockwise
		    
		    //West should be now on Top
		    //this means the tile-slots should look like that now
		    // . . .
		    // X X X
		    // . . X
		    //
		    // X means active
		    // . means inactive
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetNorthWestSlot"
		    
		    if testTile.GetNorthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top)testTile.GetNorthSlot"
		    
		    if testTile.GetNorthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetNorthEastSlot"
		    
		    if testTile.GetNorthEastSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetWestSlot"
		    
		    if testTile.GetWestSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetCentreSlot"
		    
		    if testTile.GetCentreSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetEastSlot"
		    
		    if testTile.GetEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetSouthWestSlot"
		    
		    if testTile.GetSouthWestSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetSouthSlot"
		    
		    if testTile.GetSouthSlot.active = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top) testTile.GetSouthEastSlot"
		    
		    if testTile.GetSouthEastSlot.active = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top)Townconnections"
		    
		    tcon.north = false
		    tcon.east = true
		    tcon.south = false
		    tcon.west = false
		    
		    test = testTile.GetTownConnections
		    
		    if test.StringValue(false) = tcon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "(CounterClockwise: West is on top)Streetconnections"
		    
		    scon.north = true
		    scon.east = false
		    scon.south = true
		    scon.west = false
		    
		    test = testTile.GetStreetConnections
		    
		    if test.StringValue(false) = sCon.StringValue(false) then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		  #endif
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestGetPossibleSides()
		  #if DebugBuild then
		    //todo test with neighbors set
		    
		    dim testTile as new Tile
		    dim northSide as new Town(testTile)
		    dim eastSide as new Street(testTile)
		    dim southSide as new Grassland(testTile)
		    dim westSide as new Street(testTile)
		    
		    dim newTile as new Tile
		    dim northSideA as new Grassland(newTile)
		    dim eastSideA as new Grassland(newTile)
		    dim southSideA as new Street(newTile)
		    dim westSideA as new Street(newTile)
		    
		    dim sides as Sides
		    
		    dim dbgMsg as string
		    
		    unitTests.classes = unitTests.classes + 1
		    
		    testTile.SetNorthSection northSide
		    testTile.SetEastSection eastSide
		    testTile.SetSouthSection southSide
		    testTile.SetWestSection westSide
		    
		    newTile.SetNorthSection  northSideA
		    newTile.SetEastSection eastSideA
		    newTile.SetSouthSection southSideA
		    newTile.SetWestSection westSideA
		    
		    sides = testTile.GetPossibleSides(newTile)
		    
		    dbgMsg = "(normal state), testTile.GetPossibleSides"
		    
		    if sides.east = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    newTile.RotateClockwise
		    sides = testTile.GetPossibleSides(newTile)
		    
		    dbgMsg = "(rotated: west is on top), testTile.GetPossibleSides"
		    
		    if sides.east = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    newTile.RotateClockwise
		    sides = testTile.GetPossibleSides(newTile)
		    
		    dbgMsg = "(rotated: south is on top), testTile.GetPossibleSides"
		    
		    if sides.west = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    newTile.RotateClockwise
		    sides = testTile.GetPossibleSides(newTile)
		    
		    dbgMsg = "(rotated: east is on top), testTile.GetPossibleSides"
		    
		    if sides.west = true and sides.south = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		  #endif
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestGameBoard()
		  #if DebugBuild then
		    dim board as new GameBoard
		    
		    dim tileA as new Tile
		    dim northSide as new Grassland(tileA)
		    dim eastSide as new Grassland(tileA)
		    dim southSide as new Street(tileA)
		    dim westSide as new Street(tileA)
		    
		    dim possibleCoordinates() as Coordinates
		    dim pos as Coordinates
		    
		    dim dbgMsg as string
		    dim i as integer
		    
		    unitTests.classes = unitTests.classes + 1
		    
		    tileA.SetNorthSection(northSide)
		    tileA.SetEastSection(eastSide)
		    tileA.SetSouthSection(southSide)
		    tileA.SetWestSection(westSide)
		    
		    tileA.grid.SetSlot("ne", 1)
		    tileA.grid.SetSlot("c", 2)
		    
		    
		    dbgMsg = "Testing board.GetPossibleCoordinatesForTile on StartingTile"
		    
		    possibleCoordinates = board.GetPossibleCoordinatesForTile(tileA)
		    
		    if possibleCoordinates(0).x = 1 and possibleCoordinates(0).y = 0 then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Setting Tile on Pos (1, 0)"
		    
		    pos.x = 1
		    pos.y = 0
		    
		    if board.AddTileAtPosition(tileA, pos) = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    //adding a City-Tile north
		    
		    dim tileB as new Tile
		    dim northSideB as new Town(TileB)
		    dim eastSideB as new Town(TileB)
		    dim southSideB as new Town(TileB)
		    dim westSideB as new Town(TileB)
		    
		    tileB.SetNorthSection(northSideB)
		    tileB.SetEastSection(eastSideB)
		    tileB.SetSouthSection(southSideB)
		    tileB.SetWestSection(westSideB)
		    
		    tileB.grid.SetSlot("c", 3)
		    
		    dbgMsg = "Tesiting board.GetPossibleCoordinatesForTile on TownTile"
		    
		    possibleCoordinates = board.GetPossibleCoordinatesForTile(tileB)
		    
		    if possibleCoordinates(0).x = 0 and possibleCoordinates(0).y = 1 then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgmsg
		    end if
		    
		    
		    dbgMsg = "Setting Towntile on wrong Position"
		    
		    
		    if board.AddTileAtPosition(tileB, pos) = false then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Setting Towntile on correct Positon"
		    
		    pos.x = 0
		    pos.y = 1
		    
		    if board.AddTileAtPosition(tileB, pos) = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    dim tileC as new Tile
		    dim northSideC as new Town(TileC)
		    dim eastSideC as new Street(TileC)
		    dim southSideC as new Grassland(TileC)
		    dim westSideC as new Street(TileC)
		    
		    tileC.SetNorthSection(northSideC)
		    tileC.SetEastSection(eastSideC)
		    tileC.SetSouthSection(southSideC)
		    tileC.SetWestSection(westSideC)
		    
		    tileC.grid.SetSlot("n", 3)
		    tileC.grid.SetSlot("ne", 1)
		    tileC.grid.SetSlot("c", 2)
		    tileC.grid.SetSlot("s", 1)
		    
		    
		    dbgMsg = "Testing rotated Startingtile"
		    
		    tileC.RotateClockwise
		    tileC.RotateClockwise
		    
		    possibleCoordinates = board.GetPossibleCoordinatesForTile(tileC)
		    
		    if possibleCoordinates.Ubound = 2 then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Placing rotated Startingtile on (0/2)"
		    
		    pos.x = 0
		    pos.y = 2
		    
		    if board.AddTileAtPosition(tileC, pos) = true then
		      unitTests.TestPassed dbgMsg
		    else
		      unitTests.TestFailed dbgMsg
		    end if
		    
		  #endif
		  
		End Sub
	#tag EndMethod

	#tag Method, Flags = &h1
		Protected Sub TestSlots()
		  #if DebugBuild then
		    
		    dim villageTile01 as new Tile
		    dim dbgMsg as string
		    dim d as Dictionary
		    
		    // . 1 .
		    // 2 . 2
		    // 1 2 1
		    villageTile01.SetNorthSection(new board.Grassland(villageTile01))
		    villageTile01.SetEastSection(new board.Street(villageTile01))
		    villageTile01.SetSouthSection(new board.Street(villageTile01))
		    villageTile01.SetWestSection(new board.Street(villageTile01))
		    villageTile01.grid.SetSlot("n", 1)
		    villageTile01.grid.Setslot("e", 2)
		    villageTile01.grid.SetSlot("se", 1)
		    villageTile01.grid.SetSlot("s", 2)
		    villageTile01.grid.SetSlot("sw", 1)
		    villageTile01.grid.SetSlot("w", 2)
		    
		    d = villageTile01.GetAllSlots
		    
		    dbgMsg = "Checking Keys"
		    
		    if d.HasKey("n") and d.HasKey("e") and d.HasKey("se") and _
		      d.HasKey("s") and d.HasKey("sw") and d.HasKey("w") then
		      dbgMsg = dbgMsg + " passed - all keys in slotgrid"
		      unitTests.TestPassed dbgMsg
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Testing not set Slots: "
		    
		    if villageTile01.grid.GetSlot("nw").active = false then
		      dbgMsg = dbgMsg + " passed"
		      unitTests.TestPassed dbgMsg
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Testing Slottypes"
		    
		    if villageTile01.GetNorthSlot.GetType = "Grassland" then
		      dbgMsg = dbgMsg + " passed"
		      unitTests.TestPassed dbgMsg
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    villageTile01.RotateClockwise
		    
		    // 1 2 .
		    // 2 . 1
		    // 1 2 .
		    
		    dbgMsg = "Testing rotated Slots: "
		    
		    if villageTile01.GetNorthSlot.GetType = "Street" and villageTile01.GetNorthEastSlot.GetType = "undefined" _
		      and villageTile01.GetEastSlot.GetType = "Grassland" and villageTile01.GetSouthEastSlot.GetType = "undefined" _
		      and villageTile01.GetSouthSlot.GetType = "Street" and villageTile01.GetSouthWestSlot.gettype = "Grassland" _
		      and villageTile01.GetWestSlot.GetType = "Street" and villageTile01.GetNorthWestSlot.GetType = "Grassland" then
		      dbgMsg = dbgMsg + " passed"
		      unitTests.TestPassed dbgMsg
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    //testing placement of a gamepiece
		    dbgMsg = "Testing placement of a gamepiece "
		    
		    dim p as new game.Player("test", &cCCFF66, 1, -1, nil)
		    
		    dim gp as new game.Gamepiece(p)
		    
		    
		    if villageTile01.GetNorthSlot.PlaceGamepiece(gp) = true then
		      if gp.GetType = game.Henchman.Highwayman then
		        dbgMsg = dbgMsg + " passed: placed on NorthSlot as Highwayman"
		        unitTests.TestPassed dbgMsg
		      else
		        dbgMsg = dbgMsg + " failed"
		        unitTests.TestFailed dbgMsg
		      end if
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    dbgMsg = "Removing gamepiece from slot "
		    
		    if villageTile01.GetNorthSlot.RemoveGamepiece = true then
		      if villageTile01.GetnorthSlot.occupied = false and _
		        gp.GetType = game.Henchman.Undefined then
		        dbgMsg = dbgMsg + " passed"
		        unitTests.TestPassed dbgMsg
		      else
		        dbgMsg = dbgMsg + " failed"
		        unitTests.TestFailed dbgMsg
		      end if
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		    //rotate it back and test the same field again (should be peasant now)
		    
		    dbgMsg = "Testing placement again on rotated tile "
		    
		    villageTile01.RotateCounterClockwise
		    
		    if villageTile01.GetNorthSlot.PlaceGamepiece(gp) = true then
		      if gp.GetType = game.Henchman.Peasant then
		        dbgMsg = dbgMsg + " passed: placed on NorthSlot as peasant"
		        unitTests.TestPassed dbgMsg
		      else
		        dbgMsg = dbgMsg + " failed"
		        unitTests.TestFailed dbgMsg
		      end if
		    else
		      dbgMsg = dbgMsg + " failed"
		      unitTests.TestFailed dbgMsg
		    end if
		    
		    
		  #endif
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		  
		End Sub
	#tag EndMethod


	#tag ViewBehavior
		#tag ViewProperty
			Name="Name"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Index"
			Visible=true
			Group="ID"
			InitialValue="-2147483648"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Super"
			Visible=true
			Group="ID"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Left"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
		#tag ViewProperty
			Name="Top"
			Visible=true
			Group="Position"
			InitialValue="0"
			InheritedFrom="Object"
		#tag EndViewProperty
	#tag EndViewBehavior
End Module
#tag EndModule
